function Get-InsightCloudServerParameters {
    [CmdletBinding()]
    [OutputType('Parameters')]
    param ([Parameter(Mandatory = $true, Position = 0)][Parameters]$Parameters)

    # Get all the available existing resources.
    $existing = Get-ExistingResources -ResourceGroup $Parameters.Azure.ResourceGroup

    # Ask whether LS Insight should be set on an existing server or create a new one.
    $Parameters.LSInsight.Server.UseExisting = Get-UseExistingServer -ExistingServerCount $existing.Servers.Count -UseExisting $Parameters.LSInsight.Server.UseExisting -ConfirmAll $Parameters.ConfirmAll

    if ($Parameters.LSInsight.Server.UseExisting -eq 'True') {
        # Let user select between existing servers.
        $Parameters.LSInsight.Server.Name = Get-ExistingAzureServerName -ExistingServers $existing.Servers.ResourceName -ServerName $Parameters.LSInsight.Server.Name -ConfirmAll $Parameters.ConfirmAll
        # Get the FullyQualifiedDomainName for the existing server.
        $Parameters.LSInsight.Server.FullyQualifiedDomainName = (Get-AzSqlServer -ResourceGroupName $Parameters.Azure.ResourceGroup -ServerName $Parameters.LSInsight.Server.Name).FullyQualifiedDomainName
        # Ask user for credentials on this server.
        $Parameters.LSInsight.Server.Credential = Get-ServerCredential -Message "Please provide a server admin login on the server '$($Parameters.LSInsight.Server.Name)'." -UserName $Parameters.LSInsight.Server.UserName
        $Parameters.LSInsight.Server.UserName = $Parameters.LSInsight.Server.Credential.UserName
    } else {
        # Let user create a name for the new server.
        $Parameters.LSInsight.Server.Name = Get-NewAzureServerName -Blocklist $existing.Servers.ResourceName -ServerName $Parameters.LSInsight.Server.Name -ConfirmAll $Parameters.ConfirmAll
        # Get forbidden user names.
        $blocklist = (Read-Config).Blocklists.ServerAdminLogin
        # Let user create credentials.
        $Parameters.LSInsight.Server.Credential = Get-ServerCredential -Message "Please create a server admin login for the Azure Server '$($Parameters.LSInsight.Server.Name)'. Make sure that the username is not contained in the password and that your passwords complies to the rules: Length between 8 and 128 chars, cannot start with '@' or include a single quote mark (') and must have at least one of each of the following: upper case, lower case, number and special character." -UserName $Parameters.LSInsight.Server.UserName -Confirm -Blocklist $blocklist
        $Parameters.LSInsight.Server.UserName = $Parameters.LSInsight.Server.Credential.UserName
    }

    return $Parameters
}